using DA.AnimGraph;
using OdinSerializer;
using System.Collections.Generic;

namespace DA.AnimGraph.Editor {

    internal class AGANode_Slot : AGANode_FunctionBase {

        public override AGANodeModelBase modelProperty { set => model = (AGANodeModel_Slot)value; get => model; }
        [OdinSerialize] AGANodeModel_Slot model;
        public AGANode_Slot(AGANodeModelBase model) : base(model) {
        }

        public override int Publish(List<PublishNode> outNodes, AGAPublisher.PublishContext context) {
            var pNode = new SlotPNode();
            pNode.uuid = uuid;
            pNode.data = model.Publish(context);
            var index = outNodes.Count;
            outNodes.Add(pNode);
            PublishPerks(pNode, context);
            return index;
        }
    }


    [ModelOf(typeof(AGANode_Slot))]
    internal class AGANodeModel_Slot : AGANodeModelBase {

        public string slotName;
        public float defaultDuration;

        public AGANodeModel_Slot() {
            slotName = "new slot";
            defaultDuration = 0.04f;
        }

        public SlotNode.SetupData Publish(AGAPublisher.PublishContext context) {
            return new SlotNode.SetupData() {
                defaultDuration = defaultDuration,
                slotName = slotName,
            };
        }

    }

}
